Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…rkflows, realtime, notifications, AI, and i18n Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ows, Realtime, Notifications, AI, i18n) Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds the missing client-facing protocol namespaces to @objectstack/spec so the SDK can rely on first-class Request/Response schemas (and generated JSON Schemas) for Views, Permissions, Workflows, Realtime, Notifications, AI, and i18n.
Changes:
- Added new Request/Response Zod schemas + type exports + legacy interface bindings for 7 previously-missing namespaces.
- Extended
ObjectStackProtocolSchemawith 33 new protocol methods corresponding to those operations. - Regenerated/updated JSON Schema outputs (QA schema descriptions + new API operation schemas; removed obsolete integration JSON schemas).
Reviewed changes
Copilot reviewed 80 out of 80 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/api/protocol.zod.ts | Adds new Zod request/response schemas, protocol methods, and exported TS types for the missing namespaces. |
| packages/spec/src/api/protocol.test.ts | Adds validation tests for a subset of the new protocol schemas. |
| packages/spec/json-schema/qa/TestSuite.json | Adds missing description fields in generated QA JSON schema. |
| packages/spec/json-schema/qa/TestStep.json | Adds missing description fields in generated QA JSON schema. |
| packages/spec/json-schema/qa/TestScenario.json | Adds missing description fields in generated QA JSON schema. |
| packages/spec/json-schema/qa/TestAssertionType.json | Adds missing description fields in generated QA JSON schema. |
| packages/spec/json-schema/qa/TestAssertion.json | Adds missing description fields in generated QA JSON schema. |
| packages/spec/json-schema/qa/TestActionType.json | Adds missing description fields in generated QA JSON schema. |
| packages/spec/json-schema/qa/TestAction.json | Adds missing description fields in generated QA JSON schema. |
| packages/spec/json-schema/integration/FieldTransform.json | Removes obsolete generated integration JSON schema. |
| packages/spec/json-schema/integration/Authentication.json | Removes obsolete generated integration JSON schema. |
| packages/spec/json-schema/api/WorkflowTransitionResponse.json | New generated JSON schema for WorkflowTransitionResponse. |
| packages/spec/json-schema/api/WorkflowTransitionRequest.json | New generated JSON schema for WorkflowTransitionRequest. |
| packages/spec/json-schema/api/WorkflowState.json | New generated JSON schema for WorkflowState. |
| packages/spec/json-schema/api/WorkflowRejectResponse.json | New generated JSON schema for WorkflowRejectResponse. |
| packages/spec/json-schema/api/WorkflowRejectRequest.json | New generated JSON schema for WorkflowRejectRequest. |
| packages/spec/json-schema/api/WorkflowApproveResponse.json | New generated JSON schema for WorkflowApproveResponse. |
| packages/spec/json-schema/api/WorkflowApproveRequest.json | New generated JSON schema for WorkflowApproveRequest. |
| packages/spec/json-schema/api/UpdateNotificationPreferencesResponse.json | New generated JSON schema for UpdateNotificationPreferencesResponse. |
| packages/spec/json-schema/api/UpdateNotificationPreferencesRequest.json | New generated JSON schema for UpdateNotificationPreferencesRequest. |
| packages/spec/json-schema/api/UnregisterDeviceResponse.json | New generated JSON schema for UnregisterDeviceResponse. |
| packages/spec/json-schema/api/UnregisterDeviceRequest.json | New generated JSON schema for UnregisterDeviceRequest. |
| packages/spec/json-schema/api/SetPresenceResponse.json | New generated JSON schema for SetPresenceResponse. |
| packages/spec/json-schema/api/SetPresenceRequest.json | New generated JSON schema for SetPresenceRequest. |
| packages/spec/json-schema/api/RegisterDeviceResponse.json | New generated JSON schema for RegisterDeviceResponse. |
| packages/spec/json-schema/api/RegisterDeviceRequest.json | New generated JSON schema for RegisterDeviceRequest. |
| packages/spec/json-schema/api/RealtimeUnsubscribeResponse.json | New generated JSON schema for RealtimeUnsubscribeResponse. |
| packages/spec/json-schema/api/RealtimeUnsubscribeRequest.json | New generated JSON schema for RealtimeUnsubscribeRequest. |
| packages/spec/json-schema/api/RealtimeSubscribeResponse.json | New generated JSON schema for RealtimeSubscribeResponse. |
| packages/spec/json-schema/api/RealtimeSubscribeRequest.json | New generated JSON schema for RealtimeSubscribeRequest. |
| packages/spec/json-schema/api/RealtimeDisconnectResponse.json | New generated JSON schema for RealtimeDisconnectResponse. |
| packages/spec/json-schema/api/RealtimeDisconnectRequest.json | New generated JSON schema for RealtimeDisconnectRequest. |
| packages/spec/json-schema/api/RealtimeConnectResponse.json | New generated JSON schema for RealtimeConnectResponse. |
| packages/spec/json-schema/api/RealtimeConnectRequest.json | New generated JSON schema for RealtimeConnectRequest. |
| packages/spec/json-schema/api/NotificationPreferences.json | New generated JSON schema for NotificationPreferences. |
| packages/spec/json-schema/api/Notification.json | New generated JSON schema for Notification. |
| packages/spec/json-schema/api/MarkNotificationsReadResponse.json | New generated JSON schema for MarkNotificationsReadResponse. |
| packages/spec/json-schema/api/MarkNotificationsReadRequest.json | New generated JSON schema for MarkNotificationsReadRequest. |
| packages/spec/json-schema/api/MarkAllNotificationsReadResponse.json | New generated JSON schema for MarkAllNotificationsReadResponse. |
| packages/spec/json-schema/api/MarkAllNotificationsReadRequest.json | New generated JSON schema for MarkAllNotificationsReadRequest. |
| packages/spec/json-schema/api/ListViewsRequest.json | New generated JSON schema for ListViewsRequest. |
| packages/spec/json-schema/api/ListNotificationsResponse.json | New generated JSON schema for ListNotificationsResponse. |
| packages/spec/json-schema/api/ListNotificationsRequest.json | New generated JSON schema for ListNotificationsRequest. |
| packages/spec/json-schema/api/GetWorkflowStateResponse.json | New generated JSON schema for GetWorkflowStateResponse. |
| packages/spec/json-schema/api/GetWorkflowStateRequest.json | New generated JSON schema for GetWorkflowStateRequest. |
| packages/spec/json-schema/api/GetWorkflowConfigResponse.json | New generated JSON schema for GetWorkflowConfigResponse. |
| packages/spec/json-schema/api/GetWorkflowConfigRequest.json | New generated JSON schema for GetWorkflowConfigRequest. |
| packages/spec/json-schema/api/GetViewResponse.json | New generated JSON schema for GetViewResponse. |
| packages/spec/json-schema/api/GetViewRequest.json | New generated JSON schema for GetViewRequest. |
| packages/spec/json-schema/api/GetTranslationsResponse.json | New generated JSON schema for GetTranslationsResponse. |
| packages/spec/json-schema/api/GetTranslationsRequest.json | New generated JSON schema for GetTranslationsRequest. |
| packages/spec/json-schema/api/GetPresenceResponse.json | New generated JSON schema for GetPresenceResponse. |
| packages/spec/json-schema/api/GetPresenceRequest.json | New generated JSON schema for GetPresenceRequest. |
| packages/spec/json-schema/api/GetObjectPermissionsResponse.json | New generated JSON schema for GetObjectPermissionsResponse. |
| packages/spec/json-schema/api/GetObjectPermissionsRequest.json | New generated JSON schema for GetObjectPermissionsRequest. |
| packages/spec/json-schema/api/GetNotificationPreferencesResponse.json | New generated JSON schema for GetNotificationPreferencesResponse. |
| packages/spec/json-schema/api/GetNotificationPreferencesRequest.json | New generated JSON schema for GetNotificationPreferencesRequest. |
| packages/spec/json-schema/api/GetLocalesResponse.json | New generated JSON schema for GetLocalesResponse. |
| packages/spec/json-schema/api/GetLocalesRequest.json | New generated JSON schema for GetLocalesRequest. |
| packages/spec/json-schema/api/GetFieldLabelsResponse.json | New generated JSON schema for GetFieldLabelsResponse. |
| packages/spec/json-schema/api/GetFieldLabelsRequest.json | New generated JSON schema for GetFieldLabelsRequest. |
| packages/spec/json-schema/api/GetEffectivePermissionsResponse.json | New generated JSON schema for GetEffectivePermissionsResponse. |
| packages/spec/json-schema/api/GetEffectivePermissionsRequest.json | New generated JSON schema for GetEffectivePermissionsRequest. |
| packages/spec/json-schema/api/DeleteViewResponse.json | New generated JSON schema for DeleteViewResponse. |
| packages/spec/json-schema/api/DeleteViewRequest.json | New generated JSON schema for DeleteViewRequest. |
| packages/spec/json-schema/api/CreateViewRequest.json | New generated JSON schema for CreateViewRequest. |
| packages/spec/json-schema/api/CheckPermissionResponse.json | New generated JSON schema for CheckPermissionResponse. |
| packages/spec/json-schema/api/CheckPermissionRequest.json | New generated JSON schema for CheckPermissionRequest. |
| packages/spec/json-schema/api/AiSuggestResponse.json | New generated JSON schema for AiSuggestResponse. |
| packages/spec/json-schema/api/AiSuggestRequest.json | New generated JSON schema for AiSuggestRequest. |
| packages/spec/json-schema/api/AiNlqResponse.json | New generated JSON schema for AiNlqResponse. |
| packages/spec/json-schema/api/AiNlqRequest.json | New generated JSON schema for AiNlqRequest. |
| packages/spec/json-schema/api/AiInsightsResponse.json | New generated JSON schema for AiInsightsResponse. |
| packages/spec/json-schema/api/AiInsightsRequest.json | New generated JSON schema for AiInsightsRequest. |
| packages/spec/json-schema/api/AiChatResponse.json | New generated JSON schema for AiChatResponse. |
| packages/spec/json-schema/api/AiChatRequest.json | New generated JSON schema for AiChatRequest. |
| // View Management Operations | ||
| listViews: z.function() | ||
| .describe('List views for an object'), | ||
| getView: z.function() | ||
| .describe('Get a specific view'), |
There was a problem hiding this comment.
ObjectStackProtocolSchema declares new protocol methods as z.function() with only .describe(). Without .args(...) and .returns(...), the contract doesn’t actually bind these operations to the Request/Response schemas (and inferred types degrade to unknown), which undermines the stated goal of SDK/protocol generation. Define each new method with its corresponding request schema and promise-wrapped response schema (and ideally retrofit the existing methods in this object similarly for consistency). Reference pattern: packages/spec/src/data/data-engine.zod.ts (e.g. DataEngineContractSchema.find).
| it('validates Views operations', () => { | ||
| expect(ListViewsRequestSchema.safeParse({ object: 'project', type: 'list' }).success).toBe(true); | ||
| expect(ListViewsResponseSchema.safeParse({ | ||
| object: 'project', | ||
| views: [{ list: { columns: [] } }], | ||
| }).success).toBe(true); | ||
| expect(GetViewRequestSchema.safeParse({ object: 'project', viewId: 'v1' }).success).toBe(true); | ||
| expect(CreateViewRequestSchema.safeParse({ | ||
| object: 'project', | ||
| data: { list: { columns: [] } }, | ||
| }).success).toBe(true); | ||
| expect(UpdateViewRequestSchema.safeParse({ | ||
| object: 'project', | ||
| viewId: 'v1', | ||
| data: { list: { columns: [] } }, | ||
| }).success).toBe(true); | ||
| expect(DeleteViewRequestSchema.safeParse({ object: 'project', viewId: 'v1' }).success).toBe(true); | ||
| expect(DeleteViewResponseSchema.safeParse({ object: 'project', viewId: 'v1', success: true }).success).toBe(true); | ||
| }); |
There was a problem hiding this comment.
The new protocol surface adds many Request/Response schemas, but protocol.test.ts only validates a subset. Several newly introduced schemas appear to have no test coverage anywhere in packages/spec/src (e.g. RealtimeDisconnectRequestSchema, MarkAllNotificationsReadRequestSchema, GetViewResponseSchema, UpdateViewResponseSchema). Add safeParse tests for the remaining new operations/schemas so regressions in schema shape/defaults are caught.
The
@objectstack/clientSDK surface audit identified 7 missing namespaces with no corresponding protocol definitions inprotocol.zod.ts. This adds the 33 missing Request/Response schema pairs, protocol methods, type exports, and legacy interface bindings.New protocol namespaces
listViews,getView,createView,updateView,deleteViewcheckPermission,getObjectPermissions,getEffectivePermissionsgetWorkflowConfig,getWorkflowState,workflowTransition,workflowApprove,workflowRejectwithWorkflowStateSchemafor state machine representationrealtimeConnect,realtimeDisconnect,realtimeSubscribe,realtimeUnsubscribe,setPresence,getPresenceaiNlq,aiChat,aiSuggest,aiInsightsgetLocales,getTranslations,getFieldLabelsDesign decisions
ObjectPermissionSchema,WorkflowRuleSchema,RealtimePresenceSchema,TranslationDataSchema,ViewSchema) rather than duplicating definitionsWorkflowStateSchemais new — models current state, available transitions, and transition history for the approval engineNotificationPreferencesSchemasupports per-channel overrides with digest frequency.describe()on every field,z.input<>for request types,z.infer<>for response typesExample usage
ObjectStackProtocolSchemagrows from 28 → 61 methods. Tests added for all 7 namespaces (3081 total, all passing).✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.